%> @file cc_saturation_block.m
%> @brief The function simply clips the control signal according to pre-defined limits.
%>
%> @author Mikhail Konnik
%> @date   13 January 2012
%>
%======================================================================
%> @param u_nonsat	= non-saturated control signal.
%> @param u_max		= maximum value of the signal.
%> @param u_min		= minimum value of the signal.
%> @retval u_sat	= clipped control signal according to values of \f$u_{min}\f$ and \f$u_{max}\f$.
% ======================================================================
function u_sat = cc_saturation_block(u_nonsat,u_max,u_min);

for ii=1:size(u_nonsat,1)

	if (u_nonsat(ii,1) >= max(u_max))
		u_nonsat(ii,1) = max(u_max);
	end

	if (u_nonsat(ii,1) <= min(u_min))
		u_nonsat(ii,1) = min(u_min);
	end

end %% for ii=1:size(u_nonsat,1)

u_sat = u_nonsat;